package org.csmzxy.class2333;

public class Example24 {
    public static void main(String[] args){
        int[] arr = {2,5,7,8,4};
        int max =arr[0];
        int min = arr[0];
        for (int i=1; i < arr.length;i++){
            if (arr[i] > max){
                max = arr[i];
            }if (arr[i]<min ){
                min = arr[i];
            }
        }
        System.out.println("数组arr中的最大值为" + max);
        System.out.println("数组arr中的最小值为" + min);
    }
}

